<template>
  <div class="live">
      <header>
        <div>
          <p v-for="(item,index) in arrs" :key="index" :class="cid===index?'active':'' " @click="changeCid(index)">
            {{item}}
          </p>
        </div>
        <p>
          <i class="iconfont icon-zhibo" style="color:red"></i>
          <span>直播看房</span>
        </p>
      </header>
      <div class="main" v-if="cid===0">
        <div v-for="(item) in list" :key="item.id" @click="goDetail">
          <div class="bgs">
            <p>精彩回放</p>
            <li>
              <i class="iconfont icon-yanjing"></i>
              0
            </li>
          </div>
          <h2>{{item.name}}</h2>
          <div class="txts">
            <i class="iconfont icon-zhibo" style="color:#ccc"></i>
            <span>{{item.start_time}}</span>
          </div>
        </div>
      </div>
      <div class="footer" v-if="cid!=0">
        没有更多数据了
      </div>
  </div>
</template>

<script>
import '../../../g_icon/111/iconfont.css';
import {getLiveList} from '../../../mock/home/index';
export default {
  data() {
    return {
      arrs:['不限','正在直播','精彩回放'],
      cid:0,
      list:[]
    }
  },
  mounted() {
    this.list = getLiveList();
  },
  methods: {
    changeCid(index){
      this.cid = index;
    },
    // 去详情页面
    goDetail(){
      wx.navigateTo({
          url: '/pages/home/Live/LiveDetail'
          
      });

    }
  },
}
</script>

<style lang="scss" scoped>
.live{
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0 20rpx;
  header{
    width: 100%;
    height: 100rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 34rpx;
    >div{
      width: 60%;
      display: flex;
      justify-content: space-between;
      >p{  
        padding: 5rpx 10rpx;
        background-color: #F5F5F5;
        color: #999;
      }
      .active{
        background-color: rgba(255,101,107,.1);
        color: #ff656b;
        border: 1px solid #ff656b;
      }
    }
    >p{
      font-size: 30rpx;
      text-align: center;
    }
  }
  .main{
    width: 100%;
    height: 100%;
    overflow-y: auto;
    >div{
      width: 100%;
      height: 480rpx;
      .bgs{
        width: 1000%;
        height: 300rpx;
        overflow: hidden;
        background-image: url(http://mmbiz.qpic.cn/mmbiz_jpg/7ZpMMD1dDqLW7VWbJaLvtwdpko1wZPoSfoK4WwVmJDWwH6jrV8HlcB4C8mLVZc6s42niaQa2LV2TFDLe4kkwMtw/0?x-oss-process=style/w_6401);
        background-size: 10% 370%;
        background-repeat: no-repeat;
        color: white;
        position: relative;
        p{
          width: 180rpx;
          height: 52rpx;
          border-radius: 30rpx;
          background-color: #7a97e7;
          font-size: 32rpx;
          text-align: center;
          margin: 20rpx 0 0 20rpx;
        }
        li{
          width: 100rpx;
          height: 52rpx;
          background-color: rgba(0,0,0,.5);
          border-radius: 30rpx;
          display: flex;
          justify-content: space-around;
          align-items: center;
          position: absolute;
          bottom: 20rpx;
          left: 20rpx;
        }
      }
      h2{
        width: 100%;
        height: 100rpx;
        font-weight: bold;
        font-size: 40rpx;
        line-height: 100rpx;
        text-overflow: ellipsis;
        overflow: hidden;
        text-overflow: ellipsis;
				white-space:nowrap;
      }
      .txts{
        width: 100%;
        height: 40rpx;
        display: flex;
        justify-content: space-between;
        align-items: center;
      }
    }
  }
  .footer{
    width: 100%;
    text-align: center;
  }
}
</style>